#include "Test.h"

TestSuite::TestSuite() : 
first(NULL), last(NULL)
{}

TestSuite& TestSuite::getInstance()
{
	static TestSuite ins;
	return ins;
}

void TestSuite::addCase(TestCase* _case)
{
	if (!first) {
		first = last = _case;
	}
	else {
		last->next = _case;
		last = _case;
	}
}

void TestSuite::init()
{
	TestCase* itr = first;

	while (itr) {
		itr->init();
		itr = itr->next;
	}
}

void TestSuite::destory()
{
	TestCase* itr = first;

	while (itr) {
		itr->destory();
		itr = itr->next;
	}
}

void TestSuite::doTest()
{
	TestCase* itr = first;
	while (itr) {
		itr->proc();
		itr = itr->next;
	}
}